﻿<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>html editor</title>
  <link href="style.css" rel="stylesheet">
  <script src="index.js"></script>
</head>

<body>
    <!-- 编辑器 DOM -->
    <div style="border: 1px solid #ccc;">
        <div id="editor-toolbar" style="border-bottom: 1px solid #ccc;"></div>
        <div id="editor-text-area" style="height: 500px"></div>
    </div>
  <script>
    const E = window.wangEditor

    // 切换语言
    const LANG = location.href.indexOf('lang=en') > 0 ? 'en' : 'zh-CN'
    E.i18nChangeLanguage(LANG)

    // 默认内容
    let html = `<h1>简洁模式：</h1><ol><li>简化工具栏菜单</li><li>取消选中文字的悬浮菜单</li></ol><p><br></p>`
    if (LANG === 'en') html = `<h1>Simple&nbsp;mode.</h1><ol><li>Simplify&nbsp;toolbar&nbsp;menus</li><li>Hide&nbsp;hover-bar&nbsp;when&nbsp;selected&nbsp;text</li></ol><p><br></p>`

    window.editor = E.createEditor({
      selector: '#editor-text-area',
      html,
      mode: 'simple',
      config: {
        placeholder: 'Type here...',
        MENU_CONF: {
          uploadImage: {
            fieldName: 'your-fileName',
            base64LimitSize: 10 * 1024 * 1024 // 10M 以下插入 base64
          }
        },
        onChange() {
        }
      }
    })

    window.editor.fullScreen();

    window.toolbar = E.createToolbar({
      editor,
      mode: 'simple',
      selector: '#editor-toolbar',
      config: {}
    })
  </script>
</body>

</html>
